cmake_minimum_required(VERSION 3.14)
project(eds_common)

set(CMAKE_CXX_STANDARD 17)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
#SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
SET(CMAKE_INSTALL_RPATH "./lib")
#SET(CMAKE_INSTALL_RPATH "./lib:../core")

include_directories(. include
        ../tidp/include
        /usr/local/include)

set(CMAKE_INSTALL_PREFIX ./build)

add_library(eds_common SHARED
        src/KKSFile.cpp
        src/KKSIndex.cpp
        src/KKSLatestValue.cpp
        src/KKSManger.cpp
        src/Serialize.cpp
        src/UdpPacket.cpp
        )
set_target_properties(eds_common PROPERTIES VERSION 1.2 SOVERSION 1)

add_executable(eds_tool
        eds_tool/main.cpp
        src/KKSFile.cpp
        src/KKSIndex.cpp
        src/KKSManger.cpp
        )
target_link_libraries(eds_tool
        pthread
        tidp
        )

install(TARGETS eds_common DESTINATION lib)

install(DIRECTORY include/ DESTINATION include
        FILES_MATCHING PATTERN "*.h")